C code for getting and setting group selection formulas

The following code demonstrates the use of the PEGetGroupSelectionFormula and PESetGroupSelectionFormula functions:

PEGetGroupSelectionFormula

HANDLE        textHandle;
short        textLength;
char        *formulaString;
if (!PEGetGroupSelectionFormula(Job, &textHandle, &textLength)){
    // Handle error
}
    // Allocate formulaString buffer
formulaString = (char*)malloc(textLength);
    // Retrieve actual formula string
if (!PEGetHandleString(textHandle, formulaString, textLength)){
    // Handle error
}
    // formulaString now contains text of group selection formula

PESetGroupSelectionFormula

char groupSelectionFormula [] = "Sum({orders.AMOUNT},
{orders.CUSTOMER}) > 10000.00";
if (!PESetSelectionFormula(Job, groupSelectionFormula)){
    // Handle error
}


Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com